package com.elcl.adapter;

import java.util.List;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

public class ViewPageAdapter extends PagerAdapter {
	List<View> view; 

	public ViewPageAdapter(List<View> view) {
		super();
		this.view = view;
	}

	@Override
	public int getCount() {
		return view.size();
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView(view.get(position));
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		container.addView(view.get(position));
		return view.get(position);
	}
	
	/**
	 * 解决notifyDataSetChanged不起作用的问题
	 */
	@Override
	public int getItemPosition(Object object) {
		return POSITION_NONE;
	}
	
	@Override
	public CharSequence getPageTitle(int position) {
		return "";
	}

}
